﻿using UnityEngine;
using System.Collections;
using System.Text;
using System;

public static class BlackJackController
{
    private static SocketClient _socketClient;

    static BlackJackController()
    {
        Debug.Log(Security.PrefetchSocketPolicy("127.0.0.1", 10843));
        _socketClient = new SocketClient("127.0.0.1", 12012);
        _socketClient.UnkownCommandHandler += new CommandHandler(socketClient_UnkownCommandHandler);
        _socketClient.AddCommand("PLAYER_LIST", PLAYER_LIST_Command);
    }

    private static void socketClient_UnkownCommandHandler(string data)
    {
        Debug.Log(data);
    }

    private static void PLAYER_LIST_Command(string data)
    {
        
    }

    public static void Join(int seat)
    {
        _socketClient.Command("JOIN", Convert.ToString(seat));
    }

    public static void Restart()
    {
        _socketClient.Command("RESTART");
        Application.LoadLevel("main");
    }
}
